package com.wkhyapp.lm.base;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.wkhyapp.lm.app.WkhyApp;


/**
 * Created by fangzehua on 2017/7/13.
 * 淘宝客项目
 * 邮箱:442947949@qq.com
 * QQ群:567598491
 */

public abstract class SuperActivity<P extends BasePresenter> extends BaseActivity {
    protected P mPresenter;
    public ClipboardManager myClipboard;
    public ClipData myClip;
    Intent intentFive = null;
    public  boolean doWork = true;
    public WkhyApp mApplication;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        mPresenter = createPresenter();
        myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        super.onCreate(savedInstanceState);
      //  intentFive = new Intent(this, GeTuiIntentService.class);
      //  startService(intentFive);
        mApplication = (WkhyApp) getApplication();
        translucentStatusBar();
    }

    protected abstract P createPresenter();

    @Override
    public void onResume() {
        super.onResume();
    }

    protected void translucentStatusBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window window = this.getWindow();
            // Translucent status bar
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter != null) {
            mPresenter.detachView();
        }

    }


    @Override
    public void onPause() {
        super.onPause();
    }


}
